package ar.uba.fi.algo3.java2d.ejemplo3;

import java.awt.Frame;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.FlowLayout;

public class VentanaPrincipal extends Frame {

	private static final long serialVersionUID = 1L;
	private Button botonMutar = null;
	private PanelMutante panelMutante = null;
	private Button buttonMEtido = null;
	/**
	 * This method initializes botonMutar	
	 * 	
	 * @return java.awt.Button	
	 */
	private Button getBotonMutar() {
		if (botonMutar == null) {
			botonMutar = new Button();
			botonMutar.setLabel("Mutar");
			botonMutar.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
					panelMutante.Mutar();
				}
			});
		}
		return botonMutar;
	}

	/**
	 * This method initializes panelMutante	
	 * 	
	 * @return java.awt.Panel	
	 */
	private PanelMutante getPanelMutante() {
		if (panelMutante == null) {
			FlowLayout flowLayout = new FlowLayout();
			flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
			panelMutante = new PanelMutante();
			panelMutante.setLayout(flowLayout);
			panelMutante.add(getButtonMEtido(), null);
		}
		return panelMutante;
	}

	/**
	 * This method initializes buttonMEtido	
	 * 	
	 * @return java.awt.Button	
	 */
	private Button getButtonMEtido() {
		if (buttonMEtido == null) {
			buttonMEtido = new Button();
			buttonMEtido.setLabel("metido");
		}
		return buttonMEtido;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		VentanaPrincipal ventana = new VentanaPrincipal();
		ventana.setVisible(true);
	}

	/**
	 * This is the default constructor
	 */
	public VentanaPrincipal() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(300, 200);
		this.setTitle("Java2D - Ejemplo 3");

		this.add(getBotonMutar(), BorderLayout.SOUTH);
		this.add(getPanelMutante(), BorderLayout.CENTER);
		this.addWindowListener(new java.awt.event.WindowAdapter() {
			public void windowClosing(java.awt.event.WindowEvent e) {
				System.out.println("windowClosing()"); // TODO Auto-generated Event stub windowClosing()
				System.exit(NORMAL);
			}
		});
	}

}
